import React, { Suspense, lazy } from 'react';


interface RouteType {
    path: string,
    name: string,
    menuName: string,
    code: string,
    element?: React.ReactNode; // 页面元素
}

export const lazyLoad = (Component: React.FC) => (
    <Suspense fallback="Loading...">
        <Component />
    </Suspense>
);

const Home = lazy(() => import('@src/page/home'));
const Login = lazy(() => import('@src/page/login'))
export const routeList: RouteType[] = [
    {
        path: '/home',
        name: '首页',
        menuName: 'Home',
        code: 'home',
        element: lazyLoad(Home) // 使用提取的函数
    },
    {
        path: '/login',
        name: '登陆',
        menuName: 'Login',
        code: 'login',
        element: lazyLoad(Login) // 使用提取的函数
    }
];
